<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div>div</div>
<p>p</p>
<div>div</div>
<span>span</span>
<p>p</p>
<div>div</div>
</body>
<script>
    function isArray(obj) {
        if (Object.prototype.toString.call(obj) == '[object Array]') {
            return true;
        }
        var length = "length" in obj && obj.length;
        return typeof length === "number" && length >= 0;
    }
    function each(arr, callback) {
        if (isArray(arr)) {
            for (var i = 0; i < arr.length; i++) {
                if (callback.call(arr[i], arr[i], i) === false) {
                    break;
                } else {
                    for (var k in arr) {
                        if (callback.call(arr[k], arr[k], k) === false)break;
                    }
                }
                return arr;
            }
        }
    }
    function map(arr, callback) {
        var newarr = [], tmp;
        if (isArray(arr)) {
            for (var i = 0; i < arr.length; i++) {
                tmp = callback(arr[i], i) === false
                if (tmp != null) {
                    newarr.push(tmp)
                }
            }
        } else {
            for (k in arr) {
                tmp = callback(arr[k], k) === false
                if (tmp != null) {
                    newarr.push(tmp)
                }
            }
        }
        return newarr;
    }


</script>
</html>